<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="button" value="0"><br>
  <button>+</button>
  <button name="btn">-</button>
</body>
<script>

  var t1 = document.querySelector('button')
  var t2 = document.querySelector('button[name]')
  var p = document.querySelector('input')
  var i = 0
  t1.onclick = function () {
    p.value = ++i
  }
  t2.onclick = function () {
    if (p.value > 0) {
      p.value = --i
    } else {
      alert('1111') 
    }
  }
</script>

</html>